package com.wei.czz.framework.admin.service.impl;

import com.wei.czz.framework.admin.dao.UserRiskCalculateFlowDao;
import com.wei.czz.framework.admin.entity.UserRiskCalculateFlowEntity;
import com.wei.czz.framework.admin.service.UserRiskCalculateFlowService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Objects;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2024-06-14 16:37:56
 * className: UserRiskCalculateFlowServiceImpl 用户风控计算流水服务接口实现类
 * version: 1.0
 * description:
 */
@Service("userRiskCalculateFlowService")
public class UserRiskCalculateFlowServiceImpl extends ServiceImpl<UserRiskCalculateFlowDao, UserRiskCalculateFlowEntity>
        implements UserRiskCalculateFlowService {

    private static final Logger log = LoggerFactory.getLogger(UserRiskCalculateFlowServiceImpl.class);

    @Override
    public void saveOrEdit(UserRiskCalculateFlowEntity userRiskCalculateFlow) {
        Long id = userRiskCalculateFlow.getId();
        if (Objects.isNull(id)) {
            int count = baseMapper.insert(userRiskCalculateFlow);
            log.info("插入用户风控计算流水完成。count={}", count);
        } else {

            int count = baseMapper.updateById(userRiskCalculateFlow);
            log.info("修改用户风控计算流水完成。count={}", count);
        }
    }
}